use std::cell::Cell;
use std::rc::Rc;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
use std::collections::HashMap;
use web_sys::DomParser;
use web_sys::SupportedType;
use web_sys::NamedNodeMap;
use web_sys::Attr;
use std::sync::Mutex; 
use std::error::Error;
use std::fs::File;
use std::io::Read;
use std::time::{SystemTime, UNIX_EPOCH};

// When the `wee_alloc` feature is enabled, this uses `wee_alloc` as the global
// allocator.
//
// If you don't want to use `wee_alloc`, you can safely delete this.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;

#[macro_use]
extern crate lazy_static; 
include!("facecat.rs");

#[wasm_bindgen]
extern {
    fn alert(s: &str);
}

#[wasm_bindgen]
extern {
	#[wasm_bindgen(js_namespace = console)]
    fn log(s: &str);
}

/*
* Paint event
* context:Drawing context
* view:View
* clip_rect:Crop area
*/
pub fn on_paint(context:&std::rc::Rc<web_sys::CanvasRenderingContext2d>, view:FCView, clip_rect:FCRect){
	on_paint_default(context, view.clone(), clip_rect.clone());
}

/*
* Paint border event
* context:Drawing context
* view:View
* clip_rect:Crop area
*/
pub fn on_paint_border(context:&std::rc::Rc<web_sys::CanvasRenderingContext2d>, view:FCView, clip_rect:FCRect){
	on_paint_border_default(context, view.clone(), clip_rect.clone());
}

/*
* Mouse down event
* context:Drawing context
* view:View
* mp:Coordinate
* buttons:Buttons
* clicks:Click count
* delta:Delta
*/
pub fn on_mouse_down(context:&std::rc::Rc<web_sys::CanvasRenderingContext2d>, view:FCView, mp:FCPoint, buttons:i32, clicks:i32, delta:i32){
	on_mouse_down_default(context, view.clone(), mp.clone(), buttons, clicks, delta);
}

/*
* Mouse move event
* context:Drawing context
* view:View
* mp:Coordinate
* buttons:Buttons
* clicks:Click count
* delta:Delta
*/
pub fn on_mouse_move(context:&std::rc::Rc<web_sys::CanvasRenderingContext2d>, view:FCView, mp:FCPoint, buttons:i32, clicks:i32, delta:i32){
	on_mouse_move_default(context, view.clone(), mp.clone(), buttons, clicks, delta);
}

/*
* Mouse up event
* context:Drawing context
* view:View
* mp:Coordinate
* buttons:Buttons
* clicks:Click count
* delta:Delta
*/
pub fn on_mouse_up(context:&std::rc::Rc<web_sys::CanvasRenderingContext2d>, view:FCView, mp:FCPoint, buttons:i32, clicks:i32, delta:i32){
	on_mouse_up_default(context, view.clone(), mp.clone(), buttons, clicks, delta);
}

/*
* Click event
* context:Drawing context
* view:View
* first_touch:Coordinate
* first_point:Buttons
* second_touch:Click count
* second_point:Delta
*/
pub fn on_click(context:&std::rc::Rc<web_sys::CanvasRenderingContext2d>, view:FCView, first_touch:bool, first_point:FCPoint, second_touch:bool, second_point:FCPoint, clicks:i32){
	on_click_default(context, view.clone(), first_touch, first_point.clone(), second_touch, second_point.clone(), clicks);
	if view.view_type == "plot"{
		unsafe{
			M_ADDING_PLOT = view.view_name.parse::<i32>().unwrap();
		}
	}
	else if view.view_type == "indicator"{
		for (vid, v) in M_CHART_MAP.lock().unwrap().iter_mut(){
			(*v).view = view.clone();
			if view.text == "BOLL" || view.text == "MA" {
				(*v).main_indicator = view.text.clone();
			} else {
				(*v).show_indicator = view.text.clone();
			}
			calc_chart_indicator(&mut *v);
			calculate_chart_max_min(&mut *v);
			M_VIEW_MAP.lock().unwrap().insert((*v).view.view_id, (*v).view.clone());
		}
		invalidate(context);
	}
}

/*
* Mouse wheel event
* context:Drawing context
* view:View
* mp:Coordinate
* buttons:Buttons
* clicks:Click count
* delta:Delta
*/
pub fn on_mouse_wheel(context:&std::rc::Rc<web_sys::CanvasRenderingContext2d>, view:FCView, mp:FCPoint, buttons:i32, clicks:i32, delta:i32){
	on_mouse_wheel_default(context, view.clone(), mp.clone(), buttons, clicks, delta);
}

/*
* Touch start event
* context:Drawing context
* view:View
* first_touch:Coordinate
* first_point:Buttons
* second_touch:Click count
* second_point:Delta
*/
pub fn on_touch_start(context:&std::rc::Rc<web_sys::CanvasRenderingContext2d>, view:FCView, first_touch:bool, first_point:FCPoint, second_touch:bool, second_point:FCPoint){
	on_touch_start_default(context, view.clone(), first_touch, first_point.clone(), second_touch, second_point.clone());
}

/*
* Touch move event
* context:Drawing context
* view:View
* first_touch:Coordinate
* first_point:Buttons
* second_touch:Click count
* second_point:Delta
*/
pub fn on_touch_move(context:&std::rc::Rc<web_sys::CanvasRenderingContext2d>, view:FCView, first_touch:bool, first_point:FCPoint, second_touch:bool, second_point:FCPoint){
	on_touch_move_default(context, view.clone(), first_touch, first_point.clone(), second_touch, second_point.clone());
}

/*
* Touch end event
* context:Drawing context
* view:View
* first_touch:Coordinate
* first_point:Buttons
* second_touch:Click count
* second_point:Delta
*/
pub fn on_touch_end(context:&std::rc::Rc<web_sys::CanvasRenderingContext2d>, view:FCView, first_touch:bool, first_point:FCPoint, second_touch:bool, second_point:FCPoint){
	on_touch_end_default(context, view.clone(), first_touch, first_point.clone(), second_touch, second_point.clone());
}

/*
* Start rust
*/
#[wasm_bindgen(start)]
pub fn start() -> Result<(), JsValue> {
    let window = web_sys::window().expect("should have a window in this context");
    let document = window.document().expect("window should have a document");
    let canvas = document
        .create_element("canvas")?
        .dyn_into::<web_sys::HtmlCanvasElement>()?;

    document.body().unwrap().append_child(&canvas)?;
	canvas.style().set_property("position", "fixed")?;
    canvas.style().set_property("left", "0px")?;
    canvas.style().set_property("top", "0px")?;
	let device_pixel_ratio = window.device_pixel_ratio();
	unsafe{
		M_CANVAS_WIDTH = window.inner_width().unwrap().as_f64().unwrap() as f32;
        M_CANVAS_HEIGHT = window.inner_height().unwrap().as_f64().unwrap() as f32;
		if M_CANVAS_WIDTH < M_CANVAS_HEIGHT {
            M_IS_MOBILE = true;
            M_PAINT.lock().unwrap().scale_factor_x = 2.5;
            M_PAINT.lock().unwrap().scale_factor_y = 2.5;
        }
		canvas.set_width((M_CANVAS_WIDTH * device_pixel_ratio as f32) as u32);
		canvas.set_height((M_CANVAS_HEIGHT * device_pixel_ratio as f32) as u32);
		canvas.style().set_property(&("width".to_string()), &(M_CANVAS_WIDTH.to_string() + "px")).unwrap();
		canvas.style().set_property(&("height".to_string()), &(M_CANVAS_HEIGHT.to_string() + "px")).unwrap();
	}
    let context = canvas
        .get_context("2d")?
        .unwrap()
        .dyn_into::<web_sys::CanvasRenderingContext2d>()?;
	context.scale(device_pixel_ratio, device_pixel_ratio).unwrap();
    let context = Rc::new(context);
    let pressed = Rc::new(Cell::new(false));

    { mouse_down(&context, &pressed, &canvas); }
    { mouse_move(&context, &pressed, &canvas); }
    { mouse_up(&context, &pressed, &canvas); }
    { mouse_wheel(&context, &pressed, &canvas); }
    { touch_start(&context, &pressed, &canvas); }
    { touch_move(&context, &pressed, &canvas); }
    { touch_end(&context, &pressed, &canvas); }

    let mut chart_view:FCView = FCView::new();
	chart_view.location = FCPoint{x:0.0, y:0.0};
	unsafe{
		chart_view.size = FCSize{cx:M_CANVAS_WIDTH, cy:M_CANVAS_HEIGHT * 0.6};
	}
	chart_view.back_color = "rgb(0,0,0)".to_string();
	chart_view.border_color = "rgb(100,100,100)".to_string();
	chart_view.view_type = "chart".to_string();
	chart_view.view_id = add_view(chart_view.clone());
		
	let mut grid_view:FCView = FCView::new();
	unsafe{
		grid_view.location = FCPoint{x:0.0, y:M_CANVAS_HEIGHT * 0.6};
		grid_view.size = FCSize{cx:M_CANVAS_WIDTH * 0.6, cy:M_CANVAS_HEIGHT * 0.4};
	}
	grid_view.back_color = "rgb(0,0,0)".to_string();
	grid_view.border_color = "rgb(100,100,100)".to_string();
	grid_view.view_type = "grid".to_string();
	grid_view.show_vscrollbar = true;
	grid_view.show_hscrollbar = true;
	grid_view.allow_drag_scroll = true;
	grid_view.view_id = add_view(grid_view.clone());
		
	let mut grid:FCGrid = FCGrid::new();
	grid.view = grid_view.clone();
	let mut grid_column1:FCGridColumn = FCGridColumn::new();
	grid_column1.text = String::from("date");
	grid_column1.back_color = String::from("rgb(0,0,0)");
	grid_column1.text_color = String::from("rgb(255,255,255)");
	grid_column1.border_color =  String::from("rgb(150,150,150)");
	grid_column1.frozen = true;
	grid.columns.push(grid_column1);
		
	let mut grid_column2:FCGridColumn = FCGridColumn::new();
	grid_column2.text = String::from("open");
	grid_column2.back_color = String::from("rgb(0,0,0)");
	grid_column2.text_color = String::from("rgb(255,255,255)");
	grid_column2.border_color =  String::from("rgb(150,150,150)");
	grid_column2.frozen = true;
	grid.columns.push(grid_column2);
		
	let mut grid_column3:FCGridColumn = FCGridColumn::new();
	grid_column3.text = String::from("high");
	grid_column3.back_color = String::from("rgb(0,0,0)");
	grid_column3.text_color = String::from("rgb(255,255,255)");
	grid_column3.border_color =  String::from("rgb(150,150,150)");
	grid.columns.push(grid_column3);
		
	let mut grid_column4:FCGridColumn = FCGridColumn::new();
	grid_column4.text = String::from("low");
	grid_column4.back_color = String::from("rgb(0,0,0)");
	grid_column4.text_color = String::from("rgb(255,255,255)");
	grid_column4.border_color =  String::from("rgb(150,150,150)");
	grid.columns.push(grid_column4);
		
	let mut grid_column5:FCGridColumn = FCGridColumn::new();
	grid_column5.text = String::from("close");
	grid_column5.back_color = String::from("rgb(0,0,0)");
	grid_column5.text_color = String::from("rgb(255,255,255)");
	grid_column5.border_color =  String::from("rgb(150,150,150)");
	grid.columns.push(grid_column5);
		
	let mut grid_column6:FCGridColumn = FCGridColumn::new();
	grid_column6.text = String::from("volume");
	grid_column6.back_color = String::from("rgb(0,0,0)");
	grid_column6.text_color = String::from("rgb(255,255,255)");
	grid_column6.border_color =  String::from("rgb(150,150,150)");
	grid.columns.push(grid_column6);
		
	let mut div_view:FCView = FCView::new();
	unsafe{
		div_view.location = FCPoint{x:M_CANVAS_WIDTH * 0.6, y:M_CANVAS_HEIGHT * 0.6};
		div_view.size = FCSize{cx:M_CANVAS_WIDTH * 0.2, cy:M_CANVAS_HEIGHT * 0.2};
	}
	div_view.back_color = "rgb(0,0,0)".to_string();
	div_view.border_color = "rgb(100,100,100)".to_string();
	div_view.view_type = "div".to_string();
	div_view.show_vscrollbar = true;
	div_view.show_hscrollbar = true;
	div_view.allow_drag_scroll = true;
	div_view.view_id = add_view(div_view.clone());
	let mut plots:Vec<String> = Vec::new();
    plots.push("Line".to_string());
    plots.push("Segment".to_string());
    plots.push("Ray".to_string());
    plots.push("Triangle".to_string());
    plots.push("Rect".to_string());
    plots.push("Cycle".to_string());
    plots.push("CircumCycle".to_string());
    plots.push("Ellipse".to_string());
    plots.push("AngleLine".to_string());
    plots.push("ParalleGram".to_string());
    plots.push("SpeedResist".to_string());
    plots.push("FiboFanline".to_string());
    plots.push("FiboTimezone".to_string());
    plots.push("Percent".to_string());
    plots.push("BoxLine".to_string());
    plots.push("TironeLevels".to_string());
    plots.push("Parallel".to_string());
    plots.push("GoldenRatio".to_string());
    plots.push("LRLine".to_string());
	plots.push("LRChannel".to_string());
	plots.push("LRBand".to_string());
	for i in 0..plots.len(){
		let mut sub_view:FCView = FCView::new();
		sub_view.location = FCPoint{x:50.0 * (i as f32), y:50.0 * (i as f32)};
		sub_view.size = FCSize{cx:100.0, cy:20.0};
		sub_view.back_color = "rgb(0,0,0)".to_string();
		sub_view.border_color = "rgb(100,100,100)".to_string();
		sub_view.text_color = "rgb(255,255,255)".to_string();
		sub_view.text = plots[i].clone();
		sub_view.view_name = i.to_string();
		sub_view.view_type = "plot".to_string();
		sub_view.allow_drag = true;
		add_view_to_parent(sub_view.clone(), div_view.clone());
	}
		
	let mut split_view:FCView = FCView::new();
	unsafe{
		split_view.location = FCPoint{x:M_CANVAS_WIDTH * 0.6, y:M_CANVAS_HEIGHT * 0.8};
		split_view.size = FCSize{cx:M_CANVAS_WIDTH * 0.2, cy:M_CANVAS_HEIGHT * 0.2};
	}
	split_view.back_color = "rgb(0,0,0)".to_string();
	split_view.border_color = "rgb(100,100,100)".to_string();
	split_view.view_type = "split".to_string();
	split_view.view_id = add_view(split_view.clone());
		
	let mut first_view:FCView = FCView::new();
	first_view.back_color = "rgb(255,0,0)".to_string();
	first_view.view_id = add_view_to_parent(first_view.clone(), split_view.clone());
		
	let mut second_view:FCView = FCView::new();
	second_view.back_color = "rgb(0,255,0)".to_string();
	second_view.view_id = add_view_to_parent(second_view.clone(), split_view.clone());
		
	let mut splitter:FCView = FCView::new();
	splitter.back_color = "rgb(0,0,255)".to_string();
	splitter.location = FCPoint{x:100.0, y:0.0};
	splitter.size = FCSize{cx:5.0, cy:200.0};
	splitter.view_id = add_view_to_parent(splitter.clone(), split_view.clone());
		
	let mut split:FCSplitLayoutDiv = FCSplitLayoutDiv::new();
	split.first_view = first_view.clone();
	split.second_view = second_view.clone();
	split.splitter = splitter.clone();
	split.old_size = FCSize{cx:200.0, cy:150.0};
	split.view = split_view.clone();
	reset_split_layout_div(&mut split);
	M_SPLIT_MAP.lock().unwrap().insert(split_view.view_id, split.clone());
		
	let mut layout_view:FCView = FCView::new();
	unsafe{
		layout_view.location = FCPoint{x:M_CANVAS_WIDTH * 0.8, y:M_CANVAS_HEIGHT * 0.6};
		layout_view.size = FCSize{cx:M_CANVAS_WIDTH * 0.2, cy:M_CANVAS_HEIGHT * 0.2};
	}
	layout_view.back_color = "rgb(0,0,0)".to_string();
	layout_view.border_color = "rgb(100,100,100)".to_string();
	layout_view.view_type = "layout".to_string();
	layout_view.show_vscrollbar = true;
	layout_view.show_hscrollbar = true;
	layout_view.allow_drag_scroll = true;
	layout_view.view_id = add_view(layout_view.clone());
	let mut indicators : Vec<String> = Vec::new();
    indicators.push("MA".to_string());
    indicators.push("BOLL".to_string());
    indicators.push("MACD".to_string());
    indicators.push("KDJ".to_string());
    indicators.push("BIAS".to_string());
    indicators.push("ROC".to_string());
    indicators.push("WR".to_string());
    indicators.push("DMA".to_string());
    indicators.push("RSI".to_string());
    indicators.push("BBI".to_string());
    indicators.push("CCI".to_string());
    indicators.push("TRIX".to_string());
	for i in 0..indicators.len(){
		let mut sub_view2:FCView = FCView::new();
		sub_view2.size = FCSize{cx:100.0, cy:30.0};
		sub_view2.back_color = "rgb(0,0,0)".to_string();
		sub_view2.border_color = "rgb(100,100,100)".to_string();
		sub_view2.text_color = "rgb(255,255,255)".to_string();
		sub_view2.text = indicators[i].to_string();
		sub_view2.view_name = "indicator".to_string();
		sub_view2.view_type = "indicator".to_string();
		sub_view2.allow_drag = true;
		sub_view2.margin = FCPadding{left:10.0, top:10.0, right:10.0, bottom:10.0};
		add_view_to_parent(sub_view2.clone(), layout_view.clone());
	}
	let mut layout_div:FCLayoutDiv = FCLayoutDiv::new();
		
	layout_div.view = layout_view.clone();
	layout_div.layout_style = "toptobottom".to_string();
	reset_layout_div(&mut layout_div);
	M_LAYOUT_MAP.lock().unwrap().insert(layout_view.view_id, layout_div.clone());
		
	let mut tab_view:FCView = FCView::new();
	unsafe{
		tab_view.location = FCPoint{x:M_CANVAS_WIDTH * 0.8, y:M_CANVAS_HEIGHT * 0.8};
		tab_view.size = FCSize{cx:M_CANVAS_WIDTH * 0.2, cy:M_CANVAS_HEIGHT * 0.2};
	}
	tab_view.back_color = "rgb(0,0,0)".to_string();
	tab_view.border_color = "rgb(100,100,100)".to_string();
	tab_view.view_type = "layout".to_string();
	tab_view.view_id = add_view(tab_view.clone());
		
	let mut tab:FCTabView = FCTabView::new();
	for i in 0..4{
		let mut tab_page_view:FCView = FCView::new();
		tab_page_view.size = FCSize{cx:100.0, cy:20.0};
		if i == 0{
			tab_page_view.back_color = "rgb(255,0,255)".to_string();
		}else if i == 1{
			tab_page_view.back_color = "rgb(0,255,0)".to_string();
		}else if i == 2{
			tab_page_view.back_color = "rgb(0,0,255)".to_string();
		}else if i == 3{
			tab_page_view.back_color = "rgb(255,0,0)".to_string();
		}
		tab_page_view.border_color = "rgb(100,100,100)".to_string();
		tab_page_view.text_color = "rgb(255,255,255)".to_string();
		tab_page_view.view_type = "tabpage".to_string();
		if i != 0{
			tab_page_view.visible = false;
		}
		tab_page_view.view_id = add_view_to_parent(tab_page_view.clone(), tab_view.clone());
			
		let mut header_button_view:FCView = FCView::new();
		header_button_view.size = FCSize{cx:100.0, cy:20.0};
		header_button_view.back_color = "rgb(0,0,0)".to_string();
		header_button_view.border_color = "rgb(100,100,100)".to_string();
		header_button_view.text_color = "rgb(255,255,255)".to_string();
		header_button_view.view_type = "headerbutton".to_string();
		header_button_view.text = "Page".to_string() + &(i.to_string());
		header_button_view.view_id = add_view_to_parent(header_button_view.clone(), tab_view.clone());
		let mut tab_page:FCTabPage = FCTabPage::new();
		tab_page.view = tab_page_view.clone();
		tab_page.header_button = header_button_view.clone();
		tab.tab_pages.push(tab_page);
	}
	tab.view = tab_view.clone();
	update_tab_layout(&mut tab);
	M_TAB_MAP.lock().unwrap().insert(tab_view.view_id, tab.clone());
		
	let mut security_datas:Vec<SecurityData> = Vec::new();
	let mut s_data1:SecurityData = SecurityData::new();
	s_data1.volume = 78469.756458;
	s_data1.close = 15684.25;
	s_data1.high = 15965.01;
	s_data1.low = 15272.69;
	s_data1.open = 15297.22;
	s_data1.date = 1605052800.0;
	security_datas.push(s_data1);
	let mut s_data2:SecurityData = SecurityData::new();
	s_data2.volume = 102196.366592;
	s_data2.close = 16291.87;
	s_data2.high = 16340.71;
	s_data2.low = 15440.65;
	s_data2.open = 15684.26;
	s_data2.date = 1605139200.0;
	security_datas.push(s_data2);
	let mut s_data3:SecurityData = SecurityData::new();
	s_data3.volume = 75691.891014;
	s_data3.close = 16320.71;
	s_data3.high = 16480.01;
	s_data3.low = 15952.36;
	s_data3.open = 16291.86;
	s_data3.date = 1605225600.0;
	security_datas.push(s_data3);
	let mut s_data4:SecurityData = SecurityData::new();
	s_data4.volume = 59116.357179;
	s_data4.close = 16070.46;
	s_data4.high = 16327.0;
	s_data4.low = 15670.01;
	s_data4.open = 16320.05;
	s_data4.date = 1605312000.0;
	security_datas.push(s_data4);
	let mut s_data5:SecurityData = SecurityData::new();
	s_data5.volume = 43596.851513;
	s_data5.close = 15957.01;
	s_data5.high = 16180.01;
	s_data5.low = 15774.73;
	s_data5.open = 16069.57;
	s_data5.date = 1605398400.0;
	security_datas.push(s_data5);
	let mut s_data6:SecurityData = SecurityData::new();
	s_data6.volume = 81300.685924;
	s_data6.close = 16713.58;
	s_data6.high = 16880.01;
	s_data6.low = 15864.01;
	s_data6.open = 15957.01;
	s_data6.date = 1605484800.0;
	security_datas.push(s_data6);
	let mut s_data7:SecurityData = SecurityData::new();
	s_data7.volume = 115192.02613;
	s_data7.close = 17659.39;
	s_data7.high = 17858.83;
	s_data7.low = 16538.01;
	s_data7.open = 16713.09;
	s_data7.date = 1605571200.0;
	security_datas.push(s_data7);
	let mut s_data8:SecurityData = SecurityData::new();
	s_data8.volume = 141984.264415;
	s_data8.close = 17776.13;
	s_data8.high = 18476.94;
	s_data8.low = 17222.01;
	s_data8.open = 17659.39;
	s_data8.date = 1605657600.0;
	security_datas.push(s_data8);
	let mut s_data9:SecurityData = SecurityData::new();
	s_data9.volume = 93009.571008;
	s_data9.close = 17802.83;
	s_data9.high = 18179.81;
	s_data9.low = 17335.66;
	s_data9.open = 17777.76;
	s_data9.date = 1605744000.0;
	security_datas.push(s_data9);
	let mut s_data10:SecurityData = SecurityData::new();
	s_data10.volume = 88423.028489;
	s_data10.close = 18655.68;
	s_data10.high = 18815.23;
	s_data10.low = 17740.05;
	s_data10.open = 17802.82;
	s_data10.date = 1605830400.0;
	security_datas.push(s_data10);
	let mut s_data11:SecurityData = SecurityData::new();
	s_data11.volume = 71308.137138;
	s_data11.close = 18703.81;
	s_data11.high = 18965.91;
	s_data11.low = 18308.59;
	s_data11.open = 18655.67;
	s_data11.date = 1605916800.0;
	security_datas.push(s_data11);
	let mut s_data12:SecurityData = SecurityData::new();
	s_data12.volume = 74492.806006;
	s_data12.close = 18414.61;
	s_data12.high = 18750.01;
	s_data12.low = 17699.8;
	s_data12.open = 18703.81;
	s_data12.date = 1606003200.0;
	security_datas.push(s_data12);
	let mut s_data13:SecurityData = SecurityData::new();
	s_data13.volume = 74179.661546;
	s_data13.close = 18368.01;
	s_data13.high = 18766.01;
	s_data13.low = 18000.01;
	s_data13.open = 18413.89;
	s_data13.date = 1606089600.0;
	security_datas.push(s_data13);
	let mut s_data14:SecurityData = SecurityData::new();
	s_data14.volume = 70126.693681;
	s_data14.close = 19160.02;
	s_data14.high = 19410.0;
	s_data14.low = 18207.99;
	s_data14.open = 18368.02;
	s_data14.date = 1606176000.0;
	security_datas.push(s_data14);
	let mut s_data15:SecurityData = SecurityData::new();
	s_data15.volume = 70760.56353;
	s_data15.close = 18719.12;
	s_data15.high = 19444.01;
	s_data15.low = 18570.01;
	s_data15.open = 19160.01;
	s_data15.date = 1606262400.0;
	security_datas.push(s_data15);
	let mut s_data16:SecurityData = SecurityData::new();
	s_data16.volume = 102420.321403;
	s_data16.close = 17149.48;
	s_data16.high = 18915.04;
	s_data16.low = 16188.01;
	s_data16.open = 18718.84;
	s_data16.date = 1606348800.0;
	security_datas.push(s_data16);
	let mut s_data17:SecurityData = SecurityData::new();
	s_data17.volume = 84036.578341;
	s_data17.close = 17139.53;
	s_data17.high = 17457.63;
	s_data17.low = 16438.09;
	s_data17.open = 17149.48;
	s_data17.date = 1606435200.0;
	security_datas.push(s_data17);
	let mut s_data18:SecurityData = SecurityData::new();
	s_data18.volume = 60835.734083;
	s_data18.close = 17719.86;
	s_data18.high = 17880.5;
	s_data18.low = 16865.57;
	s_data18.open = 17139.54;
	s_data18.date = 1606521600.0;
	security_datas.push(s_data18);
	let mut s_data19:SecurityData = SecurityData::new();
	s_data19.volume = 55329.026303;
	s_data19.close = 18185.0;
	s_data19.high = 18360.06;
	s_data19.low = 17517.01;
	s_data19.open = 17719.85;
	s_data19.date = 1606608000.0;
	security_datas.push(s_data19);
	let mut s_data20:SecurityData = SecurityData::new();
	s_data20.volume = 96227.350495;
	s_data20.close = 19695.88;
	s_data20.high = 19777.04;
	s_data20.low = 18185.0;
	s_data20.open = 18185.01;
	s_data20.date = 1606694400.0;
	security_datas.push(s_data20);
	let mut s_data21:SecurityData = SecurityData::new();
	s_data21.volume = 100331.141203;
	s_data21.close = 18764.97;
	s_data21.high = 19888.01;
	s_data21.low = 18350.0;
	s_data21.open = 19695.88;
	s_data21.date = 1606780800.0;
	security_datas.push(s_data21);
	let mut s_data22:SecurityData = SecurityData::new();
	s_data22.volume = 75848.875728;
	s_data22.close = 19204.1;
	s_data22.high = 19342.01;
	s_data22.low = 18330.01;
	s_data22.open = 18764.97;
	s_data22.date = 1606867200.0;
	security_datas.push(s_data22);
	let mut s_data23:SecurityData = SecurityData::new();
	s_data23.volume = 64987.682732;
	s_data23.close = 19421.91;
	s_data23.high = 19598.01;
	s_data23.low = 18867.21;
	s_data23.open = 19204.09;
	s_data23.date = 1606953600.0;
	security_datas.push(s_data23);
	let mut s_data24:SecurityData = SecurityData::new();
	s_data24.volume = 65481.220724;
	s_data24.close = 18650.53;
	s_data24.high = 19527.01;
	s_data24.low = 18565.32;
	s_data24.open = 19422.35;
	s_data24.date = 1607040000.0;
	security_datas.push(s_data24);
	let mut s_data25:SecurityData = SecurityData::new();
	s_data25.volume = 42922.758573;
	s_data25.close = 19147.67;
	s_data25.high = 19177.01;
	s_data25.low = 18500.01;
	s_data25.open = 18650.52;
	s_data25.date = 1607126400.0;
	security_datas.push(s_data25);
	let mut s_data26:SecurityData = SecurityData::new();
	s_data26.volume = 37043.101861;
	s_data26.close = 19359.41;
	s_data26.high = 19420.01;
	s_data26.low = 18857.01;
	s_data26.open = 19147.67;
	s_data26.date = 1607212800.0;
	security_datas.push(s_data26);
	let mut s_data27:SecurityData = SecurityData::new();
	s_data27.volume = 40833.661907;
	s_data27.close = 19166.91;
	s_data27.high = 19420.92;
	s_data27.low = 18902.89;
	s_data27.open = 19358.68;
	s_data27.date = 1607299200.0;
	security_datas.push(s_data27);
	let mut s_data28:SecurityData = SecurityData::new();
	s_data28.volume = 56080.515386;
	s_data28.close = 18324.12;
	s_data28.high = 19294.85;
	s_data28.low = 18200.01;
	s_data28.open = 19166.91;
	s_data28.date = 1607385600.0;
	security_datas.push(s_data28);
	let mut s_data29:SecurityData = SecurityData::new();
	s_data29.volume = 75498.213856;
	s_data29.close = 18541.29;
	s_data29.high = 18639.58;
	s_data29.low = 17650.01;
	s_data29.open = 18324.12;
	s_data29.date = 1607472000.0;
	security_datas.push(s_data29);
	let mut s_data30:SecurityData = SecurityData::new();
	s_data30.volume = 52890.685094;
	s_data30.close = 18254.64;
	s_data30.high = 18557.33;
	s_data30.low = 17911.13;
	s_data30.open = 18541.3;
	s_data30.date = 1607558400.0;
	security_datas.push(s_data30);
	let mut s_data31:SecurityData = SecurityData::new();
	s_data31.volume = 72610.734259;
	s_data31.close = 18036.54;
	s_data31.high = 18292.74;
	s_data31.low = 17572.34;
	s_data31.open = 18254.82;
	s_data31.date = 1607644800.0;
	security_datas.push(s_data31);
	let mut s_data32:SecurityData = SecurityData::new();
	s_data32.volume = 47592.761572;
	s_data32.close = 18808.7;
	s_data32.high = 18948.67;
	s_data32.low = 18020.71;
	s_data32.open = 18036.54;
	s_data32.date = 1607731200.0;
	security_datas.push(s_data32);
	let mut s_data33:SecurityData = SecurityData::new();
	s_data33.volume = 56560.831744;
	s_data33.close = 19175.0;
	s_data33.high = 19411.01;
	s_data33.low = 18711.13;
	s_data33.open = 18808.7;
	s_data33.date = 1607817600.0;
	security_datas.push(s_data33);
	let mut s_data34:SecurityData = SecurityData::new();
	s_data34.volume = 47257.211294;
	s_data34.close = 19273.15;
	s_data34.high = 19349.01;
	s_data34.low = 19000.01;
	s_data34.open = 19175.0;
	s_data34.date = 1607904000.0;
	security_datas.push(s_data34);
	let mut s_data35:SecurityData = SecurityData::new();
	s_data35.volume = 61792.483421;
	s_data35.close = 19426.44;
	s_data35.high = 19570.01;
	s_data35.low = 19050.01;
	s_data35.open = 19273.7;
	s_data35.date = 1607990400.0;
	security_datas.push(s_data35);
	let mut s_data36:SecurityData = SecurityData::new();
	s_data36.volume = 97061.040854;
	s_data36.close = 21335.53;
	s_data36.high = 21560.01;
	s_data36.low = 19278.61;
	s_data36.open = 19426.44;
	s_data36.date = 1608076800.0;
	security_datas.push(s_data36);
	let mut s_data37:SecurityData = SecurityData::new();
	s_data37.volume = 148769.444419;
	s_data37.close = 22808.99;
	s_data37.high = 23699.71;
	s_data37.low = 21233.01;
	s_data37.open = 21335.53;
	s_data37.date = 1608163200.0;
	security_datas.push(s_data37);
	let mut s_data38:SecurityData = SecurityData::new();
	s_data38.volume = 79646.144315;
	s_data38.close = 23107.4;
	s_data38.high = 23285.19;
	s_data38.low = 22350.01;
	s_data38.open = 22797.16;
	s_data38.date = 1608249600.0;
	security_datas.push(s_data38);
	let mut s_data39:SecurityData = SecurityData::new();
	s_data39.volume = 82430.712232;
	s_data39.close = 23821.62;
	s_data39.high = 24171.48;
	s_data39.low = 22750.01;
	s_data39.open = 23107.4;
	s_data39.date = 1608336000.0;
	security_datas.push(s_data39);
	let mut s_data40:SecurityData = SecurityData::new();
	s_data40.volume = 74797.201958;
	s_data40.close = 23455.53;
	s_data40.high = 24295.01;
	s_data40.low = 23060.01;
	s_data40.open = 23821.61;
	s_data40.date = 1608422400.0;
	security_datas.push(s_data40);
	let mut s_data41:SecurityData = SecurityData::new();
	s_data41.volume = 83424.441428;
	s_data41.close = 22719.72;
	s_data41.high = 24102.78;
	s_data41.low = 21815.01;
	s_data41.open = 23455.55;
	s_data41.date = 1608508800.0;
	security_datas.push(s_data41);
	let mut s_data42:SecurityData = SecurityData::new();
	s_data42.volume = 87033.13616;
	s_data42.close = 23810.8;
	s_data42.high = 23837.11;
	s_data42.low = 22353.41;
	s_data42.open = 22719.89;
	s_data42.date = 1608595200.0;
	security_datas.push(s_data42);
	let mut s_data43:SecurityData = SecurityData::new();
	s_data43.volume = 112830.021287;
	s_data43.close = 23232.77;
	s_data43.high = 24100.01;
	s_data43.low = 22810.01;
	s_data43.open = 23810.8;
	s_data43.date = 1608681600.0;
	security_datas.push(s_data43);
	let mut s_data44:SecurityData = SecurityData::new();
	s_data44.volume = 69013.844252;
	s_data44.close = 23729.21;
	s_data44.high = 23794.44;
	s_data44.low = 22703.43;
	s_data44.open = 23232.4;
	s_data44.date = 1608768000.0;
	security_datas.push(s_data44);
	let mut s_data45:SecurityData = SecurityData::new();
	s_data45.volume = 78024.251646;
	s_data45.close = 24712.48;
	s_data45.high = 24789.87;
	s_data45.low = 23434.74;
	s_data45.open = 23729.0;
	s_data45.date = 1608854400.0;
	security_datas.push(s_data45);
	let mut s_data46:SecurityData = SecurityData::new();
	s_data46.volume = 97806.523386;
	s_data46.close = 26493.4;
	s_data46.high = 26867.04;
	s_data46.low = 24500.01;
	s_data46.open = 24712.48;
	s_data46.date = 1608940800.0;
	security_datas.push(s_data46);
	let mut s_data47:SecurityData = SecurityData::new();
	s_data47.volume = 145880.8092;
	s_data47.close = 26281.67;
	s_data47.high = 28422.01;
	s_data47.low = 25700.01;
	s_data47.open = 26493.41;
	s_data47.date = 1609027200.0;
	security_datas.push(s_data47);
	let mut s_data48:SecurityData = SecurityData::new();
	s_data48.volume = 79408.740817;
	s_data48.close = 27079.42;
	s_data48.high = 27500.01;
	s_data48.low = 26101.01;
	s_data48.open = 26281.55;
	s_data48.date = 1609113600.0;
	security_datas.push(s_data48);
	let mut s_data49:SecurityData = SecurityData::new();
	s_data49.volume = 69255.341092;
	s_data49.close = 27385.01;
	s_data49.high = 27410.01;
	s_data49.low = 25880.01;
	s_data49.open = 27079.43;
	s_data49.date = 1609200000.0;
	security_datas.push(s_data49);
	let mut s_data50:SecurityData = SecurityData::new();
	s_data50.volume = 95356.067826;
	s_data50.close = 28875.55;
	s_data50.high = 28996.01;
	s_data50.low = 27320.01;
	s_data50.open = 27385.01;
	s_data50.date = 1609286400.0;
	security_datas.push(s_data50);
	let mut s_data51:SecurityData = SecurityData::new();
	s_data51.volume = 75491.419522;
	s_data51.close = 28923.64;
	s_data51.high = 29300.01;
	s_data51.low = 27850.01;
	s_data51.open = 28875.56;
	s_data51.date = 1609372800.0;
	security_datas.push(s_data51);
	let mut s_data52:SecurityData = SecurityData::new();
	s_data52.volume = 54134.113624;
	s_data52.close = 29331.7;
	s_data52.high = 29600.01;
	s_data52.low = 28624.58;
	s_data52.open = 28923.64;
	s_data52.date = 1609459200.0;
	security_datas.push(s_data52);
	let mut s_data53:SecurityData = SecurityData::new();
	s_data53.volume = 126100.088124;
	s_data53.close = 32178.34;
	s_data53.high = 33300.01;
	s_data53.low = 28946.54;
	s_data53.open = 29331.71;
	s_data53.date = 1609545600.0;
	security_datas.push(s_data53);
	let mut s_data54:SecurityData = SecurityData::new();
	s_data54.volume = 110771.806254;
	s_data54.close = 33000.06;
	s_data54.high = 34778.12;
	s_data54.low = 31963.0;
	s_data54.open = 32176.46;
	s_data54.date = 1609632000.0;
	security_datas.push(s_data54);
	let mut s_data55:SecurityData = SecurityData::new();
	s_data55.volume = 121030.155465;
	s_data55.close = 31988.72;
	s_data55.high = 33600.01;
	s_data55.low = 28130.01;
	s_data55.open = 33000.06;
	s_data55.date = 1609718400.0;
	security_datas.push(s_data55);
	let mut s_data56:SecurityData = SecurityData::new();
	s_data56.volume = 111890.475678;
	s_data56.close = 33949.54;
	s_data56.high = 34360.01;
	s_data56.low = 29900.01;
	s_data56.open = 31989.76;
	s_data56.date = 1609804800.0;
	security_datas.push(s_data56);
	let mut s_data57:SecurityData = SecurityData::new();
	s_data57.volume = 116093.037717;
	s_data57.close = 36769.37;
	s_data57.high = 36939.22;
	s_data57.low = 33288.01;
	s_data57.open = 33949.54;
	s_data57.date = 1609891200.0;
	security_datas.push(s_data57);
	let mut s_data58:SecurityData = SecurityData::new();
	s_data58.volume = 121506.449096;
	s_data58.close = 39432.29;
	s_data58.high = 40365.01;
	s_data58.low = 36300.01;
	s_data58.open = 36769.37;
	s_data58.date = 1609977600.0;
	security_datas.push(s_data58);
	let mut s_data59:SecurityData = SecurityData::new();
	s_data59.volume = 138625.042444;
	s_data59.close = 40582.82;
	s_data59.high = 41950.01;
	s_data59.low = 36500.01;
	s_data59.open = 39432.49;
	s_data59.date = 1610064000.0;
	security_datas.push(s_data59);
	let mut s_data60:SecurityData = SecurityData::new();
	s_data60.volume = 75785.989675;
	s_data60.close = 40088.23;
	s_data60.high = 41380.01;
	s_data60.low = 38720.01;
	s_data60.open = 40586.97;
	s_data60.date = 1610150400.0;
	security_datas.push(s_data60);
	let mut s_data61:SecurityData = SecurityData::new();
	s_data61.volume = 112638.990321;
	s_data61.close = 38150.03;
	s_data61.high = 41350.01;
	s_data61.low = 35111.12;
	s_data61.open = 40088.23;
	s_data61.date = 1610236800.0;
	security_datas.push(s_data61);
	let mut s_data62:SecurityData = SecurityData::new();
	s_data62.volume = 231175.583454;
	s_data62.close = 35404.48;
	s_data62.high = 38264.75;
	s_data62.low = 30420.01;
	s_data62.open = 38150.03;
	s_data62.date = 1610323200.0;
	security_datas.push(s_data62);
	let mut s_data63:SecurityData = SecurityData::new();
	s_data63.volume = 133948.161996;
	s_data63.close = 34051.25;
	s_data63.high = 36628.01;
	s_data63.low = 32531.01;
	s_data63.open = 35410.38;
	s_data63.date = 1610409600.0;
	security_datas.push(s_data63);
	let mut s_data64:SecurityData = SecurityData::new();
	s_data64.volume = 124477.924938;
	s_data64.close = 37371.39;
	s_data64.high = 37850.01;
	s_data64.low = 32380.01;
	s_data64.open = 34049.16;
	s_data64.date = 1610496000.0;
	security_datas.push(s_data64);
	let mut s_data65:SecurityData = SecurityData::new();
	s_data65.volume = 102950.399421;
	s_data65.close = 39144.51;
	s_data65.high = 40100.01;
	s_data65.low = 36701.24;
	s_data65.open = 37371.39;
	s_data65.date = 1610582400.0;
	security_datas.push(s_data65);
	let mut s_data66:SecurityData = SecurityData::new();
	s_data66.volume = 111365.804668;
	s_data66.close = 36742.23;
	s_data66.high = 39747.77;
	s_data66.low = 34538.89;
	s_data66.open = 39145.22;
	s_data66.date = 1610668800.0;
	security_datas.push(s_data66);
	let mut s_data67:SecurityData = SecurityData::new();
	s_data67.volume = 86348.441508;
	s_data67.close = 35994.99;
	s_data67.high = 37950.01;
	s_data67.low = 35357.81;
	s_data67.open = 36737.44;
	s_data67.date = 1610755200.0;
	security_datas.push(s_data67);
	let mut s_data68:SecurityData = SecurityData::new();
	s_data68.volume = 80157.737384;
	s_data68.close = 35828.62;
	s_data68.high = 36852.51;
	s_data68.low = 33850.01;
	s_data68.open = 35994.99;
	s_data68.date = 1610841600.0;
	security_datas.push(s_data68);
	let mut s_data69:SecurityData = SecurityData::new();
	s_data69.volume = 70693.90404;
	s_data69.close = 36631.28;
	s_data69.high = 37469.84;
	s_data69.low = 34800.01;
	s_data69.open = 35825.0;
	s_data69.date = 1610928000.0;
	security_datas.push(s_data69);
	let mut s_data70:SecurityData = SecurityData::new();
	s_data70.volume = 79596.541309;
	s_data70.close = 35891.5;
	s_data70.high = 37850.01;
	s_data70.low = 35844.07;
	s_data70.open = 36622.47;
	s_data70.date = 1611014400.0;
	security_datas.push(s_data70);
	let mut s_data71:SecurityData = SecurityData::new();
	s_data71.volume = 89368.432918;
	s_data71.close = 35468.24;
	s_data71.high = 36415.32;
	s_data71.low = 33400.01;
	s_data71.open = 35901.95;
	s_data71.date = 1611100800.0;
	security_datas.push(s_data71);
	let mut s_data72:SecurityData = SecurityData::new();
	s_data72.volume = 134548.811336;
	s_data72.close = 30850.14;
	s_data72.high = 35600.01;
	s_data72.low = 30071.01;
	s_data72.open = 35468.24;
	s_data72.date = 1611187200.0;
	security_datas.push(s_data72);
	let mut s_data73:SecurityData = SecurityData::new();
	s_data73.volume = 138345.853436;
	s_data73.close = 32945.18;
	s_data73.high = 33826.54;
	s_data73.low = 28850.01;
	s_data73.open = 30852.0;
	s_data73.date = 1611273600.0;
	security_datas.push(s_data73);
	let mut s_data74:SecurityData = SecurityData::new();
	s_data74.volume = 64595.297675;
	s_data74.close = 32078.01;
	s_data74.high = 33456.01;
	s_data74.low = 31390.17;
	s_data74.open = 32950.01;
	s_data74.date = 1611360000.0;
	security_datas.push(s_data74);
	let mut s_data75:SecurityData = SecurityData::new();
	s_data75.volume = 57978.047966;
	s_data75.close = 32259.91;
	s_data75.high = 33071.01;
	s_data75.low = 30900.01;
	s_data75.open = 32078.01;
	s_data75.date = 1611446400.0;
	security_datas.push(s_data75);
	let mut s_data76:SecurityData = SecurityData::new();
	s_data76.volume = 88499.236921;
	s_data76.close = 32254.21;
	s_data76.high = 34875.01;
	s_data76.low = 31910.01;
	s_data76.open = 32259.46;
	s_data76.date = 1611532800.0;
	security_datas.push(s_data76);
	let mut s_data77:SecurityData = SecurityData::new();
	s_data77.volume = 84866.207055;
	s_data77.close = 32467.78;
	s_data77.high = 32921.89;
	s_data77.low = 30837.38;
	s_data77.open = 32254.2;
	s_data77.date = 1611619200.0;
	security_datas.push(s_data77);
	let mut s_data78:SecurityData = SecurityData::new();
	s_data78.volume = 95911.971711;
	s_data78.close = 30366.16;
	s_data78.high = 32557.3;
	s_data78.low = 29241.73;
	s_data78.open = 32464.02;
	s_data78.date = 1611705600.0;
	security_datas.push(s_data78);
	let mut s_data79:SecurityData = SecurityData::new();
	s_data79.volume = 92621.155617;
	s_data79.close = 33364.87;
	s_data79.high = 33783.99;
	s_data79.low = 29842.11;
	s_data79.open = 30362.2;
	s_data79.date = 1611792000.0;
	security_datas.push(s_data79);
	let mut s_data80:SecurityData = SecurityData::new();
	s_data80.volume = 193388.622446;
	s_data80.close = 34252.21;
	s_data80.high = 38531.91;
	s_data80.low = 31915.41;
	s_data80.open = 33368.19;
	s_data80.date = 1611878400.0;
	security_datas.push(s_data80);
	let mut s_data81:SecurityData = SecurityData::new();
	s_data81.volume = 82674.758249;
	s_data81.close = 34262.89;
	s_data81.high = 34933.01;
	s_data81.low = 32825.01;
	s_data81.open = 34246.29;
	s_data81.date = 1611964800.0;
	security_datas.push(s_data81);
	let mut s_data82:SecurityData = SecurityData::new();
	s_data82.volume = 66269.928016;
	s_data82.close = 33092.99;
	s_data82.high = 34342.7;
	s_data82.low = 32171.68;
	s_data82.open = 34262.9;
	s_data82.date = 1612051200.0;
	security_datas.push(s_data82);
	let mut s_data83:SecurityData = SecurityData::new();
	s_data83.volume = 80154.567802;
	s_data83.close = 33526.38;
	s_data83.high = 34717.28;
	s_data83.low = 32296.17;
	s_data83.open = 33089.45;
	s_data83.date = 1612137600.0;
	security_datas.push(s_data83);
	let mut s_data84:SecurityData = SecurityData::new();
	s_data84.volume = 78056.66988;
	s_data84.close = 35466.25;
	s_data84.high = 35984.34;
	s_data84.low = 33418.01;
	s_data84.open = 33517.1;
	s_data84.date = 1612224000.0;
	security_datas.push(s_data84);
	let mut s_data85:SecurityData = SecurityData::new();
	s_data85.volume = 80784.343663;
	s_data85.close = 37618.88;
	s_data85.high = 37662.64;
	s_data85.low = 35362.39;
	s_data85.open = 35472.72;
	s_data85.date = 1612310400.0;
	security_datas.push(s_data85);
	let mut s_data86:SecurityData = SecurityData::new();
	s_data86.volume = 89024.320756;
	s_data86.close = 36936.67;
	s_data86.high = 38708.28;
	s_data86.low = 36161.96;
	s_data86.open = 37620.27;
	s_data86.date = 1612396800.0;
	security_datas.push(s_data86);
	let mut s_data87:SecurityData = SecurityData::new();
	s_data87.volume = 65910.531514;
	s_data87.close = 38290.25;
	s_data87.high = 38310.13;
	s_data87.low = 36570.01;
	s_data87.open = 36936.66;
	s_data87.date = 1612483200.0;
	security_datas.push(s_data87);
	let mut s_data88:SecurityData = SecurityData::new();
	s_data88.volume = 94232.612846;
	s_data88.close = 39186.95;
	s_data88.high = 40955.52;
	s_data88.low = 38215.95;
	s_data88.open = 38289.33;
	s_data88.date = 1612569600.0;
	security_datas.push(s_data88);
	let mut s_data89:SecurityData = SecurityData::new();
	s_data89.volume = 81820.439177;
	s_data89.close = 38795.7;
	s_data89.high = 39700.01;
	s_data89.low = 37351.01;
	s_data89.open = 39181.02;
	s_data89.date = 1612656000.0;
	security_datas.push(s_data89);
	let mut s_data90:SecurityData = SecurityData::new();
	s_data90.volume = 121568.794672;
	s_data90.close = 46374.88;
	s_data90.high = 46794.46;
	s_data90.low = 37988.9;
	s_data90.open = 38795.7;
	s_data90.date = 1612742400.0;
	security_datas.push(s_data90);
	let mut s_data91:SecurityData = SecurityData::new();
	s_data91.volume = 114567.009318;
	s_data91.close = 46420.43;
	s_data91.high = 48142.2;
	s_data91.low = 44961.1;
	s_data91.open = 46374.87;
	s_data91.date = 1612828800.0;
	security_datas.push(s_data91);
	let mut s_data92:SecurityData = SecurityData::new();
	s_data92.volume = 78292.89657;
	s_data92.close = 44807.59;
	s_data92.high = 47310.01;
	s_data92.low = 43800.01;
	s_data92.open = 46420.43;
	s_data92.date = 1612915200.0;
	security_datas.push(s_data92);
	let mut s_data93:SecurityData = SecurityData::new();
	s_data93.volume = 81033.184776;
	s_data93.close = 47969.52;
	s_data93.high = 48678.91;
	s_data93.low = 43994.03;
	s_data93.open = 44807.59;
	s_data93.date = 1613001600.0;
	security_datas.push(s_data93);
	let mut s_data94:SecurityData = SecurityData::new();
	s_data94.volume = 81856.490636;
	s_data94.close = 47287.61;
	s_data94.high = 48985.81;
	s_data94.low = 46400.01;
	s_data94.open = 47968.67;
	s_data94.date = 1613088000.0;
	security_datas.push(s_data94);
	let mut s_data95:SecurityData = SecurityData::new();
	s_data95.volume = 58937.84066;
	s_data95.close = 47153.7;
	s_data95.high = 48150.01;
	s_data95.low = 46202.54;
	s_data95.open = 47298.16;
	s_data95.date = 1613174400.0;
	security_datas.push(s_data95);
	let mut s_data96:SecurityData = SecurityData::new();
	s_data96.volume = 70700.864117;
	s_data96.close = 48577.8;
	s_data96.high = 49707.44;
	s_data96.low = 47014.18;
	s_data96.open = 47156.79;
	s_data96.date = 1613260800.0;
	security_datas.push(s_data96);
	let mut s_data97:SecurityData = SecurityData::new();
	s_data97.volume = 63227.659425;
	s_data97.close = 47911.11;
	s_data97.high = 49010.93;
	s_data97.low = 46174.79;
	s_data97.open = 48580.48;
	s_data97.date = 1613347200.0;
	security_datas.push(s_data97);
	let mut s_data98:SecurityData = SecurityData::new();
	s_data98.volume = 78018.176005;
	s_data98.close = 49133.46;
	s_data98.high = 50080.22;
	s_data98.low = 47003.63;
	s_data98.open = 47911.11;
	s_data98.date = 1613433600.0;
	security_datas.push(s_data98);
	let mut s_data99:SecurityData = SecurityData::new();
	s_data99.volume = 84886.224046;
	s_data99.close = 52119.72;
	s_data99.high = 52618.75;
	s_data99.low = 48947.01;
	s_data99.open = 49133.46;
	s_data99.date = 1613520000.0;
	security_datas.push(s_data99);
	let mut s_data100:SecurityData = SecurityData::new();
	s_data100.volume = 58093.930825;
	s_data100.close = 51552.61;
	s_data100.high = 52530.01;
	s_data100.low = 50901.91;
	s_data100.open = 52117.68;
	s_data100.date = 1613606400.0;
	security_datas.push(s_data100);
		
	for i in 0..security_datas.len(){
		let s_data = (&security_datas[i]).clone();
		let mut grid_row:FCGridRow = FCGridRow::new();
		let mut cell1:FCGridCell = FCGridCell::new();
		cell1.value = s_data.date.to_string();
		cell1.back_color = String::from("rgb(0,0,0)");
		cell1.text_color = String::from("rgb(255,255,255)");
		cell1.border_color = String::from("rgb(150,150,150)");
		grid_row.cells.push(cell1);
			
		let mut cell2:FCGridCell = FCGridCell::new();
		cell2.value = s_data.open.to_string();
		cell2.back_color = String::from("rgb(0,0,0)");
		cell2.text_color = String::from("rgb(255,0,0)");
		cell2.border_color = String::from("rgb(150,150,150)");
		grid_row.cells.push(cell2);
			
		let mut cell3:FCGridCell = FCGridCell::new();
		cell3.value = s_data.high.to_string();
		cell3.back_color = String::from("rgb(0,0,0)");
		cell3.text_color = String::from("rgb(0,255,0)");
		cell3.border_color = String::from("rgb(150,150,150)");
		grid_row.cells.push(cell3);
			
		let mut cell4:FCGridCell = FCGridCell::new();
		cell4.value = s_data.low.to_string();
		cell4.back_color = String::from("rgb(0,0,0)");
		cell4.text_color = String::from("rgb(255,255,0)");
		cell4.border_color =  String::from("rgb(150,150,150)");
		grid_row.cells.push(cell4);
			
		let mut cell5:FCGridCell = FCGridCell::new();
		cell5.value = s_data.close.to_string();
		cell5.back_color = String::from("rgb(0,0,0)");
		cell5.text_color = String::from("rgb(255,0,255)");
		cell5.border_color = String::from("rgb(150,150,150)");
		grid_row.cells.push(cell5);
			
		let mut cell6:FCGridCell = FCGridCell::new();
		cell6.value = s_data.volume.to_string();
		cell6.back_color = String::from("rgb(0,0,0)");
		cell6.text_color = String::from("rgb(0,255,255)");
		cell6.border_color = String::from("rgb(150,150,150)");
		grid_row.cells.push(cell6);
			
		grid.rows.push(grid_row);
	}
	M_GRID_MAP.lock().unwrap().insert(grid_view.view_id, grid.clone());
		
	let mut chart:FCChart = FCChart::new();
	chart.view = chart_view.clone();
	chart.data = security_datas;
	calc_chart_indicator(&mut chart);
	M_CHART_MAP.lock().unwrap().insert(chart_view.view_id, chart.clone());
	let top_views3 = get_top_views();
	update_view_default(top_views3);
	invalidate(&context);

	let closure = Closure::wrap(Box::new(move |_event: web_sys::Event| {
        let window3 = web_sys::window().expect("should have a window in this context");
        let document3 = window3.document().expect("window should have a document");
        unsafe{
            let device_pixel_ratio = window3.device_pixel_ratio();
            M_CANVAS_WIDTH = document3.document_element().expect("REASON").client_width() as f32;
            M_CANVAS_HEIGHT = document3.document_element().expect("REASON").client_height() as f32;
            canvas.set_width((M_CANVAS_WIDTH * device_pixel_ratio as f32) as u32);
		    canvas.set_height((M_CANVAS_HEIGHT * device_pixel_ratio as f32) as u32);
		    canvas.style().set_property(&("width".to_string()), &(M_CANVAS_WIDTH.to_string() + "px")).unwrap();
		    canvas.style().set_property(&("height".to_string()), &(M_CANVAS_HEIGHT.to_string() + "px")).unwrap();
        }
	    context.scale(device_pixel_ratio, device_pixel_ratio).unwrap();
        let top_views3 = get_top_views();
	    update_view_default(top_views3);
        invalidate(&context);
    }) as Box<dyn FnMut(_)>);
    let window2 = web_sys::window().expect("should have a window in this context");
    window2.add_event_listener_with_callback("resize", closure.as_ref().unchecked_ref()).unwrap();
    closure.forget();

	let input: web_sys::HtmlInputElement = document.create_element("input").unwrap().dyn_into().unwrap();
    input.set_type("text");
    input.set_attribute("id", "RUSTINPUTTEXT").unwrap();
    input.style().set_property("position", "absolute").unwrap();
    input.style().set_property("display", "none").unwrap();
	input.style().set_property("box-sizing", "border-box").unwrap();
    document.body().unwrap().append_child(&input)?;
    Ok(())
    //wasm-pack build --release --target web
}
